Debugging of software in real-time on real hardware often requires logging of debug data. When an error occurs in a real-time system, debug data logging is used to provide a context for the error.
Real-time debug data logging often captures the control flow of software and often includes data flow. One example, called a back-trace, provides a trace of the function calls in a program including the passed function parameters. Another example is a trace of the semaphore calls in an operating system including the data needed to identify all inter-process communications. These two examples are illustrative and do not represent a complete set.
Hardware debuggers such as in-circuit-emulators (ICE) allow debugging without overhead. Unfortunately, compilers typically optimize out function parameters which results in an ICE back-trace that does not contain the passed function parameters. Additionally, ICE debuggers halt software execution and thus end real-time operation.
Software can save data to implement real-time data logging. Software logging typically incurs a significant performance penalty for several reasons. One reason is the invocation of the logging function itself. Software logging is performed either as an in-line function or as a function call to a logging function. The in-line approach increases image size and reduces cache-hit ratios resulting in executing more instructions and with longer access time respectively. The function call approach increases image size and stack access since many registers are saved on the stack when calling a function.
Software data logging is used on embedded computers and personal computers in military and commercial applications on software images of nearly any size.